﻿@model iMyRestaurent.Models.DisplayBookingModel
@try
{
    DateTime sTime = DateTime.Parse(Model.Booking.BookingStartTime);
    DateTime eTime = DateTime.Parse(Model.Booking.BookingEndTime);
    if (eTime.CompareTo(sTime) < 0)
    {
        eTime = eTime.AddDays(1);
    }
    double sBlock = sTime.Subtract(Model.MasterData.BoundaryStartTime).TotalMinutes / 15;
    double lBlock = eTime.Subtract(sTime).TotalMinutes / 15;

    // get shift-info
    var shift = Model.MasterData.Summary.BizHourList.Where(s => s.EventID == Model.Booking.EventID).Single();

    // find table-index by TableNo
    iMyRestaurent.iRstSrv.TableDataSummary currentTable = Model.MasterData.Summary.TableList.Where(t => t.LayoutCode == Model.Booking.TableNo).Single();
    int index = Array.IndexOf(Model.MasterData.Summary.TableList, currentTable);

    if (sTime.ToString("HH:mm:ss").CompareTo(shift.Start_Time) < 0)
    {
        //continue;
    }
    else
    {   
    <div class="chart-element" event-id="@Model.Booking.EventID" imytable="@Model.Booking.iMyTableReserved" 
        start-block="@sBlock" length="@lBlock" table-index="@index" booking-id="@Model.Booking.BookingID"
        number-of-guests="@Model.Booking.NoOfGuests">
        <span class="chart-element-popup hidden"></span>
        <div class="chart-text">@Model.Booking.FullName</div>
        <div class="booking-detail">
        </div>
    </div>
    }
}
catch { }